<?php
 
// No direct access
 
defined( '_JEXEC' ) or die( 'Restricted access' );
 
jimport( 'joomla.application.component.model' );

class ShopModelOrders extends JModel
{
    
    function getOrders($done = false)
    {
		$user = &JFactory::getUser();
		if(!$user->guest)
		{
			$db =& JFactory::getDBO();
			if($done)
				$query = "SELECT * FROM #__shop_orders WHERE status='Заказ выполнен' AND ownerid=".$user->id;
			else
				$query = "SELECT * FROM #__shop_orders WHERE status!='Заказ выполнен' AND ownerid=".$user->id;
			$db->setQuery($query);
			$res = $db->loadObjectList();
			return $res;			
		}
		else
			return false;
    }
}
?>